package com.seteam.collabcrossword;

import com.seteam.collabcrossword.exceptions.CollabCrosswordException;

import java.io.Serializable;

/**
 * This class represents the clue for a word in the crossword
 */
public class Clue implements Serializable {
    private static final long serialVersionUID = 6202102937111824005L;
    private int ID;
    private String statement;
    private String answer;
    private int absoluteID;

    /**
     * Constuctor
     *
     * @param ID        the ID of the clue to be shown on the board
     * @param statement the clue's statement
     * @param answer    the answer to the clue
     * @throws CollabCrosswordException if any of the passed parameters fail checks
     */
    public Clue(final int ID, final String statement, final String answer) throws CollabCrosswordException {
        CollabCrosswordUtils.checkNotNull(statement, Globals.CLUE_ERROR +
                "The statement cannot be null or empty");
        CollabCrosswordUtils.checkNotNull(answer, Globals.CLUE_ERROR + "The answer cannot be null or empty");
        CollabCrosswordUtils.isPositive(ID, Globals.CLUE_ERROR + "The ID cannot be negative");
        this.ID = ID;
        this.statement = statement;
        this.answer = answer;
        this.absoluteID = 0;
    }

    /**
     * Setter for absoluteID
     *
     * @param absoluteID the absoluteID of the clue. This is the value
     *                   that will be displayed on the board
     */
    public void setAbsoluteID(final int absoluteID) {
        this.absoluteID = absoluteID;
    }

    /**
     * Getter for absoluteID
     *
     * @return the value of absoluteID
     */
    public int getAbsoluteID() {
        return absoluteID;
    }

    /**
     * Getter for statement
     *
     * @return the clue
     */
    public String getStatement() {
        return statement;
    }


    /**
     * Getter for answer
     *
     * @return the answer associated with this clue
     */
    public String getAnswer() {
        return answer;
    }

    /**
     * Getter for ID
     *
     * @return the clue's ID
     */
    public int getID() {
        return ID;
    }
}
